<template>
  <!-- <edit-table
      ref="editTableRef"
      v-model:tableData="tableData"
      v-model:tableColumn="tableColumn.formTemplateFieldVOList"
      :rules="rules"
    ></edit-table> -->
  <zcb-stage :stage="stage"></zcb-stage>
  <zcb-radio v-model="checkValue" :list="radioList"></zcb-radio>
  <zcb-table-v3 :tableList="dataList" :totalList="totalList" :materialColumn="materialColumn" :supplierColumn="supplierColumn"></zcb-table-v3>
</template>

<script setup>
import { ref } from 'vue'
const stage = ref([
  { name: '项目创建', status: 'success', code: '' },
  { name: '供应商审核', status: 'success', code: '' },
  { name: '保证金缴纳', status: 'success', code: '' },
  { name: '报价议价', status: 'process', code: '' },
  { name: '定标', status: 'wait', code: '' },
  { name: '授标', status: 'wait', code: '' }
])
const checkValue = ref(true)
const radioList = ref([
  { name: '定标商品 (N)', code: true },
  { name: '不定标商品 (M)', code: false }
])
const totalList = ref([
  {
    name: '报价币种',
    code: 'currencyDesc'
  },
  {
    name: '贸易条款',
    code: 'tradeTerms'
  },
  {
    name: '付款条件',
    code: 'paymentTerms'
  },
  {
    name: '首末轮降幅比',
    code: 'firstLastDecrease'
  },
  {
    name: '交货时间',
    code: 'deliveryTime'
  },
  {
    name: '总计 (含税)',
    code: 'priceTotalTax'
  },
  {
    name: '总计 (不含税)',
    code: 'priceTotalNonTax'
  },
  {
    name: '定选币种比价',
    code: 'currencyComparison'
  }
])
// table数据
const dataList = ref({
  // 供应商
  quoteList: [
    {
      id: 13,
      supplierId: 46269,
      supplierTenantId: 14307,
      supplierTenantName: '同博pre供应商01',
      currencyName: '人民币',
      currencyCode: 'CNY',
      currencyDesc: '人民币CNY ￥', // 报价币种
      tradeTerms: 'DDP', // 贸易条款
      paymentTerms: '阿斯顿发斯蒂芬', // 付款条件
      firstLastDecrease: 0, // 首末轮降幅比
      deliveryTime: '2023-12-09', // 交货时间
      priceTotalTax: 6081212.0, // 总计 (含税)
      priceTotalNonTax: 6021200.0, // 总计 (不含税)
      currencyComparison: 6021200.0, // 定选币种比价
      minPriceTotalTax: true, // 是否最低 总计 (含税)
      minPriceTotalNonTax: true, // 是否最低 总计 (不含税)
      currencyRate: 1,
      currencySymbol: '￥'
    },
    {
      id: 14,
      supplierId: 46270,
      supplierTenantId: 14307,
      supplierTenantName: '同博pre供应商01',
      currencyName: '人民币',
      currencyCode: 'CNY',
      currencyDesc: '人民币CNY ￥', // 报价币种
      tradeTerms: 'DDP', // 贸易条款
      paymentTerms: '阿斯顿发斯蒂芬', // 付款条件
      firstLastDecrease: 1, // 首末轮降幅比
      deliveryTime: '2023-12-09', // 交货时间
      priceTotalTax: 6081212.0, // 总计 (含税)
      priceTotalNonTax: 6021200.0, // 总计 (不含税)
      currencyComparison: 6021200.0, // 定选币种比价
      minPriceTotalTax: true, // 是否最低 总计 (含税)
      minPriceTotalNonTax: true, // 是否最低 总计 (不含税)
      currencyRate: 1,
      currencySymbol: '￥'
    }
  ],
  // 物料行
  materialList: [
    {
      id: 296,
      rowKey: '1',
      children: [],
      value: {
        materialCode: 'test001',
        materialName: '北京',
        materialDestination: '上海',
        materialQuantity: '10.00',
        materialUnit: '箱',
        materialDesc: '测试描述001'
      },
      quoteLineList: [
        {
          id: 73,
          quoteId: 13,
          materialId: 296,
          supplierId: 46269,
          selected: false,
          isEdit: false,
          value: {
            id: 278,
            eventId: 14687,
            priceNonTax: 10.0,
            priceTotalNonTax: 100.0,
            priceTotalTax: 101.0,
            priceTax: 10.1,
            minPriceTax: true,
            taxRate: '1.00',
            rowKey: 1
          }
        },
        {
          id: 74,
          quoteId: 14,
          materialId: 296,
          supplierId: 46270,
          selected: false,
          isEdit: false,
          value: {
            id: 278,
            eventId: 14687,
            priceNonTax: 10.0,
            priceTotalNonTax: 100.0,
            priceTotalTax: 101.0,
            priceTax: 10.1,
            taxRate: '1.00',
            rowKey: 1
          }
        }
      ],
      quoteStatus: 1,
      calibrationLineList: null
    },
    {
      id: 297,
      rowKey: '2',
      children: [
        {
          id: 299,
          rowKey: '2-1',
          nonCalibration: null,
          nonCalibrationDesc: null,
          value: {
            materialDesc: '测试描述001',
            materialsBill: '大号',
            id: 281,
            materialCode: 'test004',
            materialDestination: '上海',
            materialQuantity: '10.00',
            materialUnit: '个',
            materialName: '北京',
            purchaseCategoryName: '二级分类6688',
            rowKey: '2-1'
          },
          children: [],
          quoteLineList: [
            {
              id: 74,
              quoteId: 14,
              materialId: 296,
              supplierId: 46269,
              selected: false,
              isEdit: false,
              value: {
                id: 278,
                eventId: 14687,
                priceNonTax: 10.0,
                priceTotalNonTax: 2000.0,
                priceTotalTax: 2020.0,
                priceTax: 10.1,
                taxRate: '1.00',
                rowKey: 1
              }
            }
          ]
        }
      ],
      value: {
        materialCode: 'test001',
        materialName: '北京',
        materialDestination: '上海',
        materialQuantity: '10.00',
        materialUnit: '箱',
        materialDesc: '测试描述001'
      },
      quoteLineList: [
        {
          id: 80,
          quoteId: 13,
          materialId: 297,
          supplierId: 46269,
          selected: false,
          isEdit: false,
          value: {
            id: 278,
            eventId: 14687,
            priceNonTax: 10.0,
            priceTotalNonTax: 100.0,
            priceTotalTax: 101.0,
            priceTax: 10.1,
            taxRate: '1.00',
            rowKey: 1
          }
        },
        {
          id: 80,
          quoteId: 14,
          materialId: 297,
          supplierId: 46270,
          selected: false,
          isEdit: false,
          value: {
            id: 278,
            eventId: 14687,
            priceNonTax: 10.0,
            priceTotalNonTax: 100.0,
            priceTotalTax: 101.0,
            priceTax: 10.1,
            taxRate: '1.00',
            rowKey: 1
          }
        }
      ],
      quoteStatus: 1,
      calibrationLineList: null
    },
    {
      rowKey: '9999',
      value: {}
    }
  ]
})
// 物料表头
const materialColumn = ref([
  {
    id: 4111,
    code: 'materialCode',
    name: '物料编码4567890123456789',
    type: 1,
    model: 1,
    seqNum: 1,
    visible: true,
    dataType: 3,
    dataPurchaser: 3,
    dataSupplier: 1,
    dataFormula: null,
    dataFormulaView: null,
    dataFormulaBom: 0,
    dataFormulaPreset: null,
    dataFormulaFrontend: null
  },
  {
    id: 4112,
    code: 'materialName',
    name: '始发地45678901234567890',
    type: 1,
    model: 1,
    seqNum: 2,
    visible: true,
    dataType: 3,
    dataPurchaser: 2,
    dataSupplier: 1,
    dataFormula: null,
    dataFormulaView: null,
    dataFormulaBom: 0,
    dataFormulaPreset: null,
    dataFormulaFrontend: null
  },
  {
    id: 4113,
    code: 'materialDestination',
    name: '目的地45678901234567890',
    type: 1,
    model: 1,
    seqNum: 3,
    visible: true,
    dataType: 3,
    dataPurchaser: 2,
    dataSupplier: 1,
    dataFormula: null,
    dataFormulaView: null,
    dataFormulaBom: 0,
    dataFormulaPreset: null,
    dataFormulaFrontend: null
  },
  {
    id: 4114,
    code: 'materialQuantity',
    name: '采购数量4567890123456789',
    type: 1,
    model: 1,
    seqNum: 4,
    visible: true,
    dataType: 1,
    dataPurchaser: 2,
    dataSupplier: 1,
    dataFormula: null,
    dataFormulaView: null,
    dataFormulaBom: 0,
    dataFormulaPreset: null,
    dataFormulaFrontend: null
  },
  {
    id: 4115,
    code: 'materialUnit',
    name: '单位45678901234567890',
    type: 1,
    model: 1,
    seqNum: 5,
    visible: true,
    dataType: 3,
    dataPurchaser: 2,
    dataSupplier: 1,
    dataFormula: null,
    dataFormulaView: null,
    dataFormulaBom: 0,
    dataFormulaPreset: null,
    dataFormulaFrontend: null
  },
  {
    id: 4116,
    code: 'materialDesc',
    name: '物料描述4567890123456789',
    type: 1,
    model: 1,
    seqNum: 6,
    visible: true,
    dataType: 3,
    dataPurchaser: 3,
    dataSupplier: 1,
    dataFormula: null,
    dataFormulaView: null,
    dataFormulaBom: 0,
    dataFormulaPreset: null,
    dataFormulaFrontend: null
  }
])
// 供应商表头
const supplierColumn = ref([
  {
    id: 4119,
    code: 'priceNonTax',
    name: '不含税单价456789012345678',
    type: 1,
    model: 2,
    seqNum: 9,
    visible: true,
    dataType: 2,
    dataPurchaser: 1,
    dataSupplier: 2,
    dataFormula: '',
    dataFormulaView: null,
    dataFormulaBom: 0,
    dataFormulaPreset: null,
    dataFormulaFrontend: null
  },
  {
    id: 4121,
    code: 'priceTotalNonTax',
    name: '不含税总价456789012345678',
    type: 1,
    model: 2,
    seqNum: 11,
    visible: true,
    dataType: 4,
    dataPurchaser: 1,
    dataSupplier: 1,
    dataFormula: 'priceNonTax * materialQuantity',
    dataFormulaView: '不含税总价=不含税单价*采购数量',
    dataFormulaBom: 0,
    dataFormulaPreset: null,
    dataFormulaFrontend:
      '[{"value":"不含税单价","key":"priceNonTax","type":"obj","cursor":false},{"value":"*","key":"*","type":"plain","cursor":false},{"value":"采购数量","key":"materialQuantity","type":"obj","cursor":false}]'
  },
  {
    id: 4122,
    code: 'priceTax',
    name: '含税单价4567890123456789',
    type: 1,
    model: 2,
    seqNum: 12,
    visible: true,
    dataType: 4,
    dataPurchaser: 1,
    dataSupplier: 1,
    dataFormula: 'priceNonTax * (1 + taxRate/100)',
    dataFormulaView: '含税单价=不含税单价*(1+税率/100)',
    dataFormulaBom: 0,
    dataFormulaPreset: null,
    dataFormulaFrontend:
      '[{"value":"不含税单价","key":"priceNonTax","type":"obj","cursor":false},{"value":"*","key":"*","type":"plain","cursor":false},{"value":"(","key":"(","type":"plain","cursor":false},{"value":"1","key":"1","type":"num","cursor":false},{"value":"+","key":"+","type":"plain","cursor":false},{"value":"税率","key":"taxRate","type":"obj","cursor":false},{"value":"/","key":"/","type":"plain","cursor":false},{"value":"100","key":"100","type":"num","cursor":false},{"value":")","key":")","type":"plain","cursor":true}]'
  },
  {
    id: 4123,
    code: 'priceTotalTax',
    name: '含税总价4567890123456789',
    type: 1,
    model: 2,
    seqNum: 13,
    visible: true,
    dataType: 4,
    dataPurchaser: 1,
    dataSupplier: 1,
    dataFormula: '(priceNonTax * materialQuantity) * (1 + taxRate/100)',
    dataFormulaView: '含税总价=(不含税单价*采购数量)*(1+税率/100)',
    dataFormulaBom: 0,
    dataFormulaPreset: null,
    dataFormulaFrontend:
      '[{"cursor":false,"type":"placeholder","value":""},{"value":"(","key":"(","type":"plain","cursor":false},{"value":"不含税单价","key":"priceNonTax","type":"obj","cursor":false},{"value":"*","key":"*","type":"plain","cursor":false},{"value":"采购数量","key":"materialQuantity","type":"obj","cursor":false},{"value":")","key":")","type":"plain","cursor":false},{"value":"*","key":"*","type":"plain","cursor":false},{"value":"(","key":"(","type":"plain","cursor":false},{"value":"1","key":"1","type":"num","cursor":false},{"value":"+","key":"+","type":"plain","cursor":false},{"value":"税率","key":"taxRate","type":"obj","cursor":false},{"value":"/","key":"/","type":"plain","cursor":false},{"value":"100","key":"100","type":"num","cursor":true},{"value":")","key":")","type":"plain","cursor":false}]'
  },
  {
    id: 4124,
    code: 'taxRate',
    name: '税率45678901234567890',
    type: 1,
    model: 2,
    seqNum: 14,
    visible: true,
    dataType: 1,
    dataPurchaser: 1,
    dataSupplier: 2,
    dataFormula: null,
    dataFormulaView: null,
    dataFormulaBom: 0,
    dataFormulaPreset: null,
    dataFormulaFrontend: null
  }
])
</script>

<style lang="scss"></style>

<style lang="scss" scoped></style>
